package network

import (
	"fmt"
	"net/http"
	"net/http/httputil"
)

/**
定义一个结构体
*/
type FileDownload struct {
	Header string
}

/**
实现下载接口
*/
func (download *FileDownload) Download(url string) string {
	fmt.Println("network start download from ", url)

	response, err := http.Get(url)
	if err != nil {
		panic(err)
	}


	result, err := httputil.DumpResponse(response, true)
	if err != nil {
		panic(err)
	}

	response.Body.Close()

	return string(result)

}
